package com.summer.service.impl;

import com.summer.entity.gongxinbao.RelBaseInfo;
import com.summer.mapper.gongxinbao.RelBaseInfoDao;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

/**
 * Created by tl on 2018/8/9.
 */
public class BaseRelativizeService {
    private static Logger LOG = LoggerFactory.getLogger(BaseRelativizeService.class);
    @Autowired
    private RelBaseInfoDao relBaseInfoDao;

    public Long getBaseId(String identityCard, String userPhone, String name, String messageType) {
        if (StringUtils.isBlank(identityCard) && StringUtils.isBlank(userPhone)) {
            LOG.info("null == identityCard&&userPhone Relativize_" + messageType);
            return null;
        }
        RelBaseInfo relBaseInfo = new RelBaseInfo(userPhone, identityCard, name, messageType,
                new Date());
        relBaseInfoDao.insert(relBaseInfo);
        return relBaseInfo.getId();
    }
}
